﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdSiShapePlane : OdSiShape, IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdSiShapePlane(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdSiShapePlane obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdSiShapePlane()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdSiShapePlane(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		HandleRef OdSiShape.GetCPtr()
		{
			return new HandleRef(this, GlobalsPINVOKE.OdSiShapePlane_OdSiShape_GetCPtr(this.swigCPtr.Handle));
		}

		public OdGePoint3d m_pointOnPlane
		{
			get
			{
				IntPtr intPtr = GlobalsPINVOKE.OdSiShapePlane_m_pointOnPlane_get(this.swigCPtr);
				OdGePoint3d result = (intPtr == IntPtr.Zero) ? null : new OdGePoint3d(intPtr, false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdSiShapePlane_m_pointOnPlane_set(this.swigCPtr, OdGePoint3d.getCPtr(value));
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdGeVector3d m_planeNormal
		{
			get
			{
				IntPtr intPtr = GlobalsPINVOKE.OdSiShapePlane_m_planeNormal_get(this.swigCPtr);
				OdGeVector3d result = (intPtr == IntPtr.Zero) ? null : new OdGeVector3d(intPtr, false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdSiShapePlane_m_planeNormal_set(this.swigCPtr, OdGeVector3d.getCPtr(value));
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdSiShapePlane(OdGePoint3d pointOnPlane, OdGeVector3d planeNormal) : this(GlobalsPINVOKE.new_OdSiShapePlane__SWIG_0(OdGePoint3d.getCPtr(pointOnPlane), OdGeVector3d.getCPtr(planeNormal)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdSiShapePlane(OdGePlane plane) : this(GlobalsPINVOKE.new_OdSiShapePlane__SWIG_1(OdGePlane.getCPtr(plane)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public double signedDistanceTo(OdGePoint3d pt)
		{
			double result = GlobalsPINVOKE.OdSiShapePlane_signedDistanceTo(this.swigCPtr, OdGePoint3d.getCPtr(pt));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool contains(OdGeExtents3d arg0, bool arg1, OdGeTol arg2)
		{
			bool result = GlobalsPINVOKE.OdSiShapePlane_contains(this.swigCPtr, OdGeExtents3d.getCPtr(arg0), arg1, OdGeTol.getCPtr(arg2));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool intersects(OdGeExtents3d extents, bool planar, OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.OdSiShapePlane_intersects(this.swigCPtr, OdGeExtents3d.getCPtr(extents), planar, OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdSiShape clone()
		{
			OdSiShapeImpl result = new OdSiShapeImpl(GlobalsPINVOKE.OdSiShapePlane_clone(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void transform(OdGeMatrix3d arg0)
		{
			GlobalsPINVOKE.OdSiShapePlane_transform(this.swigCPtr, OdGeMatrix3d.getCPtr(arg0));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public static OdSiShape kOverallSpace
		{
			get
			{
				OdSiShapeImpl result = new OdSiShapeImpl(GlobalsPINVOKE.OdSiShapePlane_kOverallSpace_get(), false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
		}

		public static OdSiShape kNoSpace
		{
			get
			{
				OdSiShapeImpl result = new OdSiShapeImpl(GlobalsPINVOKE.OdSiShapePlane_kNoSpace_get(), false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
